package com.sskj.cndragon.ui.activity;


import android.support.design.widget.NavigationView;

import com.lzy.okgo.model.Response;
import com.sskj.cndragon.bean.WithDrawBean;
import com.sskj.cndragon.presenter.BasePresenter;
import com.sskj.common.base.HttpData;
import com.sskj.common.util.MD5Util;
import com.sskj.common.util.ToastUtil;
import com.sskj.lib.http.JsonCallBack;

/**
 * @author Hey
 * Create at  2019/06/26
 */
class WithDrawPresenter extends BasePresenter<WithDrawActivity> {

    public void withDraw(String userID, String dragonID, String cny, String paypwd) {
        httpService.withDraw(userID, dragonID, cny, MD5Util.getMd5Value(paypwd))
                .tag(this)
                .execute(new JsonCallBack<HttpData>(this) {
                    @Override
                    public void onSuccess(Response<HttpData> response) {
                        ToastUtil.showShort(response.message());
                        mView.finish();
                    }
                });
    }

    public void getWithdrawPre(String uid) {
        httpService.getWithdrawPre(uid)
                .tag(this)
                .execute(new JsonCallBack<HttpData<WithDrawBean>>(this) {
                    @Override
                    public void onSuccess(Response<HttpData<WithDrawBean>> response) {
                        mView.getWithdrawPreOK(response.body().getData());
                    }
                });
    }
}
